FUNCTION: StrComp( )
StrComp(String1, String2, Compare)
The StrComp function compares two strings to see if they are the same.
If the strings are the same, the output is zero.
If the strings are different, the output will be a 1 or -1
depending on the order the strings.
There are two mandatory arguments.
String1
The String1 argument is the first of two strings to compare.
String2
The String2 argument is the second of two strings to compare.
Code:
<% =StrComp("Mountains of the Moon", "Mountains of the
Moon") %>
Output:
0
Code:
<% =StrComp("Mountains of
the Moon", "Red sails at sunset") %>
Output:
-1
There is one optional arguments.
Compare
The optional Compare argument must only use the constant or value of the
COMPARISON CONSTANTS.
CONSTANT | VALUE | DESCRIPTION |
VBBinaryCompare | 0 | Binary comparison |
VBTextCompare | 1 | Text Comparison |
VBDataBaseCompare | 2 | Compare information inside
database |
Code:
<%
=StrComp("Mountains of the Moon", "mountains of the
moon", 0) %>
Output:
-1
Code:
<% =StrComp("Mountains of
the Moon", "mountains of the moon", 1) %>
Output:
0
Code:
<% =StrComp("RED",
"red", VBTextCompare) %>
Output:
0